package com.julis.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.julis.fragment.CarInfo2_Fragment;
import com.julis.fragment.ObuInfo1_Fragment;



public class OBU_jiance_FragmentAdapter extends FragmentPagerAdapter {
    private String[] titleStr = null;
    public CarInfo2_Fragment carInfo2_fragment;
    public ObuInfo1_Fragment obuInfo1_fragment;
//    public CardInfo3_Fragment cardInfo3_fragment;



    private static final String[] CONTENT2 = new String[]{"系统信息", "车辆信息"
    };

    public OBU_jiance_FragmentAdapter(FragmentManager fm, Context context) {
        super(fm);


        titleStr = CONTENT2;


    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {

            case 0:
                if (obuInfo1_fragment == null) {
                    obuInfo1_fragment = new ObuInfo1_Fragment();
                }
                return obuInfo1_fragment;
            case 1:
                if (carInfo2_fragment == null) {
                    carInfo2_fragment = new CarInfo2_Fragment();
                }
                return carInfo2_fragment;
//            case 2:
//                if (cardInfo3_fragment == null) {
//                    cardInfo3_fragment = new CardInfo3_Fragment();
//                }
//                return cardInfo3_fragment;
            default:
                return null;

        }

    }

    @Override
    public CharSequence getPageTitle(int position) {

        return titleStr[position];
    }

    @Override
    public int getItemPosition(Object object) {

        return POSITION_NONE;
    }

    @Override
    public int getCount() {

        return titleStr.length;
    }

}
